laravel date diff

38

$fdate = $request->Fdate;
$tdate = $request->Tdate;
$datetime1 = new DateTime($fdate);
$datetime2 = new DateTime($tdate);
$interval = $datetime1->diff($datetime2);
$days = $interval->format('%a');//now do whatever you like with $days
$expDate = Carbon::now()->subDays(15));
Table::whereDate('exp_date', '<',$expDate); 

Comments

Submit
0 Comments